home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / bb212src / bbsrtbpc.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-01-12  |  4.9 KB  |  128 lines

  1. (*=========================================================================*)
  2. (* Monitor command for BPQ-HOST                                            *)
  3. (*                                                                         *)
  4. (*  Copyright 1992 by H. Roy Engehausen.  All rights reserved.             *)
  5. (*                                                                         *)
  6. (*=========================================================================*)
  7.  
  8. (*===========================================================================*)
  9. (* Process monitor command                                                   *)
  10. (*    Results:                                                               *)
  11. (*             0 = no monitor                                                *)
  12. (*             1 = monitor                                                   *)
  13. (*             2 = command error                                             *)
  14. (*===========================================================================*)
  15.  
  16. FUNCTION bpq_monitor_command : BYTE;
  17.  
  18.   VAR
  19.     new_set : BYTE;
  20.     filter  : BYTE;
  21.     i       : BYTE;
  22.     p       : port_block_ptr;
  23.     s       : STRING[10];
  24.  
  25.   BEGIN;
  26.  
  27.     (*-----------------------------------------------------------------------*)
  28.     (* Prepare the scan                                                      *)
  29.     (*-----------------------------------------------------------------------*)
  30.  
  31.     s := data_place.data_ptr^.str_data;
  32.     upcase_str_var(s);
  33.  
  34.     (*-----------------------------------------------------------------------*)
  35.     (* Just "M"?                                                             *)
  36.     (*-----------------------------------------------------------------------*)
  37.  
  38.     IF LENGTH(s) = 1 THEN
  39.       BEGIN;
  40.         bpq_monitor_command := 2;
  41.         EXIT;
  42.       END;
  43.  
  44.     (*-----------------------------------------------------------------------*)
  45.     (* Process the parms                                                     *)
  46.     (*-----------------------------------------------------------------------*)
  47.  
  48.     filter := 0;
  49.  
  50.     IF s <> 'MN' THEN
  51.       BEGIN;
  52.  
  53.         (*-------------------------------------------------------------------*)
  54.         (* Scan the letters                                                  *)
  55.         (*-------------------------------------------------------------------*)
  56.  
  57.         FOR i := 2 TO LENGTH(s) DO
  58.           BEGIN;
  59.             CASE s[i] OF
  60.               'I' : new_set := bpq_monitor_i;
  61.               'U' : new_set := bpq_monitor_ui;
  62.               'S' : new_set := bpq_monitor_s;
  63.               'F' : new_set := bpq_monitor_F0;
  64.               'C' : new_set := bpq_monitor_CF;
  65.               'A' : new_set := bpq_monitor_other + bpq_monitor_F0
  66.                                                               + bpq_monitor_CF;
  67.               ELSE
  68.                 BEGIN;
  69.                   bpq_monitor_command := 2;
  70.                   EXIT;
  71.                 END;
  72.             END;
  73.  
  74.             filter := filter OR new_set;
  75.  
  76.           END;
  77.  
  78.       END;
  79.  
  80.     (*-----------------------------------------------------------------------*)
  81.     (* Default the PID scan to all                                           *)
  82.     (*-----------------------------------------------------------------------*)
  83.  
  84.     IF (filter AND (bpq_monitor_other + bpq_monitor_F0+ bpq_monitor_cf)) = 0
  85.       THEN
  86.         filter := filter + bpq_monitor_other + bpq_monitor_F0 + bpq_monitor_CF;
  87.  
  88.     (*-----------------------------------------------------------------------*)
  89.     (* Set the filter                                                        *)
  90.     (*-----------------------------------------------------------------------*)
  91.  
  92.     active_port^.mon_filter := filter;
  93.  
  94.     (*-----------------------------------------------------------------------*)
  95.     (* See if monitor is on anywhere                                         *)
  96.     (*-----------------------------------------------------------------------*)
  97.  
  98.     p := active_port^.main_port;
  99.  
  100.     i := 0;
  101.  
  102.     REPEAT
  103.       {$IFDEF POINT_CHK}
  104.         test_pointer(p);
  105.       {$ENDIF}
  106.       IF active_port^.mon_filter <> 0 THEN
  107.         i := 1;
  108.       p := p^.rel_port;
  109.     UNTIL (p = NIL) OR (i <> 0);
  110.  
  111.     (*-----------------------------------------------------------------------*)
  112.     (* Set the result based on monitor scan results                          *)
  113.     (*-----------------------------------------------------------------------*)
  114.  
  115.     bpq_monitor_command := i;
  116.  
  117.     (*-----------------------------------------------------------------------*)
  118.     (* Ensure the result is on everybody                                     *)
  119.     (*-----------------------------------------------------------------------*)
  120.  
  121.     p := active_port^.main_port;
  122.     REPEAT
  123.       p^.port_monitor := BOOLEAN(i);
  124.       p := p^.rel_port;
  125.     UNTIL p = NIL;
  126.  
  127.   END;
  128.